#pragma once
#include "maya/MPoint.h"
#include "maya/MItMeshPolygon.h"
#include "maya/MItMeshVertex.h"
#include "maya/MIntArray.h"
#include <vector>

using namespace std;
class VertexBase;
class EdgeBase;
class TriangleBase
{
public:
	struct angleTriple {
		double A;
		double B;
		double C;
	};

	TriangleBase(MItMeshPolygon* _faceIt, MItMeshVertex* _vertsIt, int _faceNumber, VertexBase* _A, VertexBase* _B, VertexBase* _C, EdgeBase* _ab, EdgeBase* _bc, EdgeBase* _ca);
	TriangleBase();
	~TriangleBase(void);
	
	//Core Data Setters
	void updateAngles(angleTriple triple);
	void setOptimalAngles();

	//Core Data Getters
	int getNum();
	angleTriple getAngles();
	vector<VertexBase*> getCorners();
	vector<EdgeBase*> getSides();
	MIntArray* getAdjacentFaceIndices();
	double getPrevAngle(VertexBase* input);
	double getNextAngle(VertexBase* input);	
	EdgeBase* getABEdge();

	//Objective Function Calls
	double sumAngles();
	double getAngularDistortion();
	
	//Utility
	void printContents();	
		
	//Distortion
	bool inRadiusOf(VertexBase* vertex, double radius);

private:
	char findAngleName(VertexBase* input);

	int faceNumber;

	VertexBase* A;
	VertexBase* B;
	VertexBase* C;
	vector<VertexBase*> points;

	EdgeBase* abEdge;
	EdgeBase* bcEdge;
	EdgeBase* caEdge;
	vector<EdgeBase*> sides;
};

